#include "define.h"
using namespace std;

int main(int argc, char* argv[])
{
	ixp_graph ixp;
	ixp.crea_grafi();
	if ( ixp.calcola_metriche(0) == -1 ) {
    	cerr<<"Errore nel calcolo delle metriche"<<endl;
		exit(1);
	}
	if ( ixp.calcola_metriche(1) == -1 ) {
		cerr<<"Errore nel calcolo delle metriche"<<endl;
		exit(1);
	}
	if ( ixp.calcola_metriche(2) == -1 ) {
		cerr<<"Errore nel calcolo delle metriche"<<endl;
		exit(1);
	}
	ixp.stampa_proprieta_ixp();
	ixp.check_metrics();
	ixp.stampa_metriche_asn();
	ixp.calcola_metriche_agg();
	ixp.stampa_proprieta_aggregate();
	const int len = 14;
	int id_ixp[len]={122,184,21,13,19,22,25,90,10,17,11,185,64,155};
	ixp.stampa_proprieta_ixp_gnuplot(id_ixp,len,0);
	for ( int i = 0; i < len; i++ ) {
		ixp.stampa_as_tear1_gnuplot(id_ixp[i], gnuplot_as_tear_1);
		for ( int j = 0; j < 3; j++ ) {
			//ixp.stampa_shind_pmf(id_ixp[i], j);
			ixp.stampa_shell_index_ccdf( id_ixp[i], j, gnuplot_siccdf_base );
			ixp.stampa_degree_ccdf( id_ixp[i], j, gnuplot_dgccdf_base );
		}
	    ixp.stampa_globaldg_ccdf( id_ixp[i], 0, gnuplot_global_dgccdf_base );
	}
	for (int i=0; i<3; i++)
	    ixp.stampa_proprieta_ixp_gnuplot(NULL, 0, i);
	ixp.stampa_prop_ixp_agg_gnuplot( 0, gnuplot_agg_0 );
	ixp.stampa_prop_ixp_agg_gnuplot( 1, gnuplot_agg_1 );
	ixp.stampa_prop_ixp_agg_gnuplot( 2, gnuplot_agg_2 );
	/*
	NON SI USANO
	ixp.stampa_proprieta_as_gnuplot( 0, gnuplot_as_0 );
	ixp.stampa_proprieta_as_gnuplot( 1, gnuplot_as_1 );
	ixp.stampa_proprieta_as_gnuplot( 2, gnuplot_as_2 );
	*/

    ixp.ordina_members_gnuplot(0,gnuplot_members_0);
    ixp.ordina_members_gnuplot(1,gnuplot_members_1);
    ixp.ordina_members_gnuplot(2,gnuplot_members_2); 
    ixp.ordina_peering_gnuplot(0,gnuplot_peering_0);
    ixp.ordina_peering_gnuplot(1,gnuplot_peering_1);
    ixp.ordina_peering_gnuplot(2,gnuplot_peering_2);
    ixp.ordina_as_members_gnuplot(gnuplot_as_members);
    ixp.ordina_as_connectivity_gnuplot(gnuplot_as_connectivity);
    
    string continents[6] = { "AF", "AS", "EU", "LA", "NA", "OC" };
    for ( int i = 0; i < 6; i++ )
    	for ( int j = 0; j < 3; j++ ) {
    		//ixp.stampa_shell_index_pmf( continents[i], j, gnuplot_sipmf_base );
    		ixp.stampa_shell_index_ccdf( continents[i], j, gnuplot_siccdf_base );
    		ixp.stampa_link_density_ccdf( continents[i], j, gnuplot_ldccdf_base ); 
    	}
	ixp.valutazione_ixp();
	return 0;
}

